
<template>
  <div>
	<div class="table margin-top padding-bottom">
	  <div class="list" v-for="l in data" :key='l.id'>
		  <div class="left">
			  <img src="../../../assets/img/pen2.png" alt="">
			  <h1>{{l.name}}</h1>
		  </div>
		  <p>套餐内容：
		  <br>
		  <br>
		  1、赠送<input type="text" v-model="l.gold" >金币
		  <br>
		  <br>
		  2、赠送<input type="text" v-model="l.housing">条房源数量
		   <br>
		   <br>
		   价格：<input type="text" v-model="l.price">元
		   <br>
		   <el-button type="primary" @click="che1(l.id)">修改</el-button>
		   </p>
		  
	  </div>
	</div>
  </div>
</template>

<script>
import { setlist,updatelist } from '@/api/api'
export default {
  data() {
    return {
    	readonlys:true,
		data:[]
    }
  },
  created() {
	  
	  setlist({type:1}).then(data => {
	  			  if(data.code == 200){
	  				  this.data=data.data
	  			  }
	  })
  },
  methods: {
	  che1(id){
			  
			  var deft;
			  for(var i=0;i<this.data.length;i++){
			  			 if(id==this.data[i].id){
			  				 deft=this.data[i]
			  			 }
			  			
			  }
			  updatelist(deft).then(data => {
			  			  if(data.code == 200){
			  				   Is.tip('编辑成功', 2000, 'success')
			  			  }
			  })
			  
	  }
  }}
</script>

<style lang="scss" scoped>
	.list{
		margin-top: 45px;
		.left{
			display: inline-block;
			width: 120px;
			height: 120px;
			vertical-align: top;
			border: 1px solid #ddd;
			img{
				display: block;
				width: 120px;
				height: 120px;
			}
			h1{
				font-size: 18px;
				color: #333;
				width: 120px;
				text-align: center;
			}
		}
		
			
			p{
				display: inline-block;
				vertical-align: top;
				font-size: 16px;
				color: #333;
				margin: 0;
				margin-left: 25px;
				input{
					width: 40px;
					height: 40px;
					font-size: 16px;
					color: #333;
					outline: none;
					text-align: center;
					margin-left: 8px;
					margin-right: 8px;
				}
				button{
						margin-top: 15px;
				}
			}
		}
</style>

